package com.gis507.test.AISDataToMysqlTest;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class Redece extends Reducer<Text, IntWritable,TestBean,NullWritable> {

    @Override
    protected void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        int sum = 0;
        for(IntWritable val:values) {
            sum += val.get();
        }
        TestBean keywordTable = new TestBean(key.toString(),sum);
        context.write(keywordTable, NullWritable.get());
    }

}
